import requests

def getPageData(url):
    myResponse = requests.get(url)
    myResponse.encoding = myResponse.apparent_encoding
    print(myResponse.status_code)
    print(myResponse.text)

def createFile(url):
    myResponse = requests.get(url)
    myResponse.encoding = "utf-8"
    print("响应的状态码是：" + str(myResponse.status_code))
    print("响应后的头部信息是：" + str(myResponse.headers))
    print("相应内容包括：" + myResponse.text)

    try:
        file = open("myfile", "w", encoding="utf-8")
        file.write(myResponse.text)
        print("生成文件成功")
    except:
        print("生成文件失败")
    else:
        file.close()
